package cn.com.fattiger.reflect;

import java.lang.reflect.Field;

public class ReflectDemo {

	private String name;
	
	private String getName(){
		return name;
	}
	
	public static void main(String[] args) throws Exception {
		ReflectDemo rd = new ReflectDemo();
		Class<?> rdClass1 = rd.getClass();
		Class<?> rdClass2 = ReflectDemo.class;
		Class<?> clazz = Class.forName("cn.com.fattiger.reflect.ReflectDemo");
		ReflectDemo rd1 = (ReflectDemo) clazz.newInstance();
		Field field = clazz.getDeclaredField("name");
		field.setAccessible(true);
		field.set(rd1, "1111111");
		System.out.println(rd.getName());
	}

}
